﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace GraphsLab5
{
    class Matrix
    {
        bool?[,] a;
        int n;

        public Matrix(int n)
        {
            a = new bool?[n, n];
            this.n = n;
        }

        public int Length
        {
            get
            {
                return n;
            }
        }

        public bool this[int i, int j]
        {
            get
            {
                if (a[i, j] != null) return true;
                return false;
            }
            set
            {
                a[i, j] = value;
            }
        }

        public override string ToString()
        {
            string s = "";
            if (this.Length > 0)
            {
                for (int i = 0; i < this.Length; i++)
                {
                    for (int j = 0; j < this.Length; j++)
                    {
                        if (this[i, j]) s += "1 ";
                        else s += "0 ";
                    }
                    s += "\n";
                }
            }
            return s;
        }

    }
}
